package org.neuedu.chapter09_0629.demo01;

import java.util.Objects;

public class Citizen {
    private long idCard;
    private String username;

    @Override
    public String toString() {
        return "Citizen{" +
                "idCard=" + idCard +
                ", username='" + username + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object obj) {
        return this.getIdCard() == ((Citizen)obj).getIdCard();
    }

    @Override
    public int hashCode() {
        return Objects.hash(idCard, username);
    }

    public long getIdCard() {
        return idCard;
    }

    public void setIdCard(long idCard) {
        this.idCard = idCard;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
}
